package com.baeldung.bidirect;

import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by dzy on 2018/9/1
 */
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,property = "id")
public class User2 {
  public int id;
  public String name;

  public List<Item2> userItems = new ArrayList<>();

  public User2(int id, String name) {
    this.id = id;
    this.name = name;
  }

  public void addItem(Item2 item) {
    userItems.add(item);
  }
}
